package com.sgb.kjwl.view.ui.fragment.transport;

import android.view.View;

import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.FragmentMyOrderListBinding;
import com.swgk.core.common.base.BaseFragment;
import com.swgk.core.common.base.BaseViewModel;
import com.swgk.core.recyclerview.adapter.SlidingFragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Time:2021/8/26
 * Author:黄淋
 * Description:接单列表
 */
public class MyOrderListFragment extends BaseFragment<BaseViewModel,FragmentMyOrderListBinding> {

    private final String[] mTabs = new String[]{"全部", "已接单", "货主已同意", "货主未同意"};
    private SlidingFragmentPagerAdapter adapter;

    @Override
    protected int layoutId() {
        return R.layout.fragment_my_order_list;
    }

    @Override
    protected void createViewModel() {

    }

    public static MyOrderListFragment newInstance() {
        return new MyOrderListFragment();
    }

    @Override
    protected void init() {
        initFragment();
        mBinding.tabLayout.setNormalColor96();
    }

    private void initFragment() {
        //viewPager适配器
        ArrayList<Fragment> fragments = new ArrayList<>();
        //添加页面
        for (int i = 0; i < mTabs.length; i++) {
            fragments.add(MyOrderFragment.newInstance(i));
        }
        adapter = new SlidingFragmentPagerAdapter(getChildFragmentManager(), fragments, mTabs);
        mBinding.vpMyOrder.setAdapter(adapter);
        mBinding.vpMyOrder.setOffscreenPageLimit(3);
        mBinding.tabLayout.setupWithViewPager(mBinding.vpMyOrder);
    }

    @Override
    public void onClick(View v) {

    }
}
